<?php

/*
Setting Up fish For Pets (admin_set_fishpets.pro.php)
*/

$rank_check = "7";
include "../global.inc.php";

$game=$_GET['game'];
$fish_pets = $_POST['fish_pets'];
$fish_items = $_POST['fish_items'];


$explodePets = explode(", ", $fish_pets);
echo $explodePets . ",";
$countPets = count($explodePets) - 1;
echo $countPets . ",";

if ($countPets != "0")
{
for ($a = 0; $a <= $countPets;)
{
	$findPet = fetch("SELECT * FROM pets2 WHERE name = '$explodePets[$a]' AND game = '$game'");
		if (!$findPet[id])
		{
			die(header(error("admin_set_fishpets.php?game=$game","The pet \"$explodePets[$a]\" does 	not exsist!")));
		}
	$a++;
}
}

$explodeItems = explode(", ", $fish_items);
echo $explodeItems . ",";
$countItems = count($explodeItems) - 1;
echo $countItems . ",";

if ($countItems != "0")
{
for ($a = 0; $a <= $countItems;)
{
	$findItems = fetch("SELECT * FROM items2 WHERE item_name = '$explodeItems[$a]' AND game = '$game'");
		if (!$findItems[id])
		{
			die(header(error("admin_set_fishpets.php?game=$game","The item \"$explodeItems[$a]\" does 	not exsist!")));
		}
	$a++;
}
}

mysql_query("UPDATE fish_pets_arrays SET pets = '$fish_pets' WHERE game = '$game'");
mysql_query("UPDATE fish_pets_arrays SET items = '$fish_items' WHERE game = '$game'");

//header("Location: admin_set_fishpets.php?game=$game&error=The+game+has+been+setup!");

?>
